﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace ExtrudeGalaxy3d
{
    class MenuItem
    {
        Texture2D itemMenu;
        Rectangle objMenu, ObjMouse;

        bool Click;

        public MenuItem(Game1 g, String imagem, int x, int y, int w, int h)
        {
            objMenu = new Rectangle(x, y, w, h);
            ObjMouse = new Rectangle(0, 0, 0, 0);
            itemMenu = g.Content.Load<Texture2D>(imagem);
            Click = false;
        
        }

        public bool Clicou(MouseState m)
        {

            objMenu.X = m.X;
            objMenu.Y = m.Y;
            ObjMouse.Width = 50;
            objMenu.Height = 50;

            if (m.LeftButton == ButtonState.Pressed)
            {
                if (!Click)
                {
                    Click = true;
                    if (ObjMouse.Intersects(objMenu))
                        return true;
                    else
                        return false;
                }
                else
                {
                    return false;
                }
            }
            else
            {
                Click = false;
                return false;
            }
        

        }
        
        public void DesenhaNaTela(SpriteBatch tela)
        {
            tela.Draw(itemMenu, objMenu, Color.White);
        }
    }

}
